
cc.Class({
    extends: require('wy-Component'),

    properties: {
        launcher : require('SkillLauncher'),
        players : [cc.Node],
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
      
        this.n_fireTime = 0
        this.n_playerId = 0;
    },

    start () {
        this.launcher.setSkillParentNode(this.launcher.node,true);
        var getCount=global.Data.signIn.signCount;
        if(getCount<=3){
            this.setPlaneId(1)
        }else{
            this.setPlaneId(2)
        }
    },

    
    setPlaneId(id){
        this.level = 4;
        this.planeId=id;
        this.startFire(id);
    },
    startFire(id){
        this.launcher.reset();
        // this.launcher.node.y = (this.n_playerId==2?-60:10)
        this.players[0].active=false
        this.players[1].active=false
        this.players[id-1].active=true
        var arr=['player2','player3']
        var option = global.DataConfig.monster[arr[id-1]]
        var skills = option.status[Math.min(4,this.level)];

        this.launcher.addLauncher(option.status[Math.min(4,3)])
        if(this.level===4){
            this.unscheduleAllCallbacks()
            this.ani().play(this.ani()._clips[0].name);
            SoundMgr.playSound('Audio/Transform_hero_0',false,0.5);
            this.scheduleOnce(()=>{
                this.players[id-1].getChildByName('baozou').active=true;
                this.launcher.reset();
                this.launcher.addLauncher(skills)
            },0.5)
        }
    },

    ani(){
        return this.players[this.planeId-1].getChildByName('change1').getComponent(cc.Animation)
    },

});
